package com.matt.service.impl;

import com.matt.foundation.vo.course.PadCoursePlanDetailVo;
import com.matt.repository.base.ClassesChildrenRepository;
import com.matt.repository.course.CoursePlanClassesRepository;
import com.matt.repository.course.CourseRepository;
import com.matt.repository.course.PrepareCourseRepository;
import com.matt.service.CourseKXThemeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class CourseKXThemeServiceImpl implements CourseKXThemeService{

	@Autowired
	private CourseRepository courseRepository;

	@Autowired
	private CoursePlanClassesRepository coursePlanClassesRepository;

	@Autowired
	private ClassesChildrenRepository classesChildrenRepository;

	@Autowired
	PrepareCourseRepository prepareCourseRepository;
	@Override
	public PadCoursePlanDetailVo getKXThemeCourseDetail(String coursePlanClassesId) {
		// TODO: 需要获取详情，叠加备课信息
//		CoursePlanClasses coursePlanClasses = coursePlanClassesRepository.getOne(coursePlanClassesId);
//		Course course = courseRepository.getOne(coursePlanClasses.getCourseId());
//
//		List<AdviseDetailDO> adviseList = classesChildrenRepository.findAdviseByClasses(coursePlanClasses.getClassesId());//查询班级学生评测建议
//		List<TeacherDO> teacherList = teacherService.getTeacherByClasses(coursePlanClasses.getClassesId());
//		Classes classes = classesRepository.getOne(coursePlanClasses.getClassesId());
//
//		Object template;
//
//		CourseTemplate4 courseTemplate4 = courseTemplate4Repository.getOne(course.getCourseTemplateId());
//		if(Objects.nonNull(courseTemplate4.getParentid())&&courseTemplate4.getParentid()!=""){
//			CourseTemplate4 courseTemplate4Theme = courseTemplate4Repository.getOne(courseTemplate4.getParentid());
////	        	courseTemplate4.setCourseidea(courseTemplate4Theme.getCourseidea());
////	        	courseTemplate4.setCourseobjective(courseTemplate4Theme.getCourseobjective());
////	        	courseTemplate4.setCourserangetable(courseTemplate4Theme.getCourserangetable());
////	        	if(courseTemplate4.getType()!=4){
////				courseTemplate4.setTeachingObjectives(courseTemplate4Theme.getTeachingObjectives());
//			courseTemplate4.setObserverpoints(courseTemplate4Theme.getObserverpoints());
////	        	}
//		}
//		PrepareCourse prepareCourse = prepareCourseRepository.findByCoursePlanClassesId(coursePlanClasses.getId());
//
//		if (Objects.nonNull(prepareCourse) && CourseNurseryConstant.PrepareStatus.PREPARED.codeOf() == coursePlanClasses.getPrepareStatus() || CourseNurseryConstant.PrepareStatus.APPROVED.codeOf() == coursePlanClasses.getPrepareStatus()) {
//			PrepareTemplate4 prepareTemplate4 = prepareTemplate4Repository.findByPrepareCourseId(prepareCourse.getId());
//			template = PadCourseTemplate4Vo.ofPrepareCourse(prepareCourse, prepareTemplate4);
//		} else
//			template = PadCourseTemplate4Vo.ofCourse(coursePlanClasses, courseTemplate4);
//
//		List<ChildrenCourseItemDO> itemList = childChildrenCourseItemRepository.findByChildrenByCoursePlanId(coursePlanClasses.getId());
//
//		PadCoursePlanDetailVo vo = PadCoursePlanDetailVo.ofAreaBuild(course.getTemplateType(), coursePlanClasses, itemList, adviseList, teacherList, template, classes.getName());
//		return vo;
		return null;
	}

}
